#!/usr/bin/python

import pygame as p
import os
import json as js

class Load:
    def load_fonts(self):
        self.title_font=p.font.Font(os.path.join("fonts",'simhei.ttf'),80)
        self.version_font=p.font.Font(os.path.join("fonts",'simhei.ttf'),40)
        self.comment_font=p.font.Font(os.path.join("fonts","simhei.ttf"),20)
#        self.title_font=p.font.SysFont(['方正粗黑宋简体','microsoftsansserif'],120)
#        self.version_font=p.font.SysFont(['方正粗黑宋简体','microsoftsansserif'],50)
    def load_datas(self):
        with open(os.path.join("datas","vanilla.json"),'r',encoding='utf-8') as f:
            self.vanilla=js.load(f)
        with open(file=os.path.join('datas','colors.json'),mode='r',encoding='utf-8') as f:
            self.color=js.load(f)
    def load_images(self):
#        self.screen1=p.image.load(os.path.join('images','screen1.png')).convert()
        self.icon=p.image.load(os.path.join("images","icon.png")).convert_alpha()
        self.school=p.image.load(os.path.join("images","school.png")).convert()
        self.qiyijun=p.image.load(os.path.join('images','qiyijun.png')).convert()
        self.white_flag=p.transform.scale(p.image.load(os.path.join('images','white.gif')).convert_alpha(),(45,75))
        self.blue_flag=p.transform.scale(p.image.load(os.path.join('images','blue.gif')).convert_alpha(),(45,75))
        self.red_flag=p.transform.scale(p.image.load(os.path.join('images','red.gif')).convert_alpha(),(45,75))
        self.screen3=p.image.load(os.path.join('images','screen3.png')).convert()
    def new_red(self):
        return p.transform.scale(p.image.load(os.path.join('images','red.gif')).convert_alpha(),(45,75))
    def new_blue(self):
        return p.transform.scale(p.image.load(os.path.join('images','blue.gif')).convert_alpha(),(45,75))
    def new_white(self):
        return p.transform.scale(p.image.load(os.path.join('images','white.gif')).convert_alpha(),(45,75))
    def __init__(self):
        self.load_images()
        self.load_datas()
        self.load_fonts()
#        print("Loaded general:",repr(self.general))